package com.abcode.test.oracletest.query.define.query;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
public class QueryController {
    @Autowired
    private MyBatisPlusMapper myBatisPlusMapper;
     @GetMapping("/query")
    public List<Object> query(
            @RequestParam String tableName,
            @RequestParam QueryCondition[] conditions
    ) {
        List<QueryCondition> conditionList = Arrays.asList(conditions);
        return myBatisPlusMapper.selectByTableNameAndConditions(tableName, conditionList);
    }
}